import os

import openai
from dotenv import load_dotenv

load_dotenv("../ai.env")

openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_key = os.getenv("OPENAI_KEY")

messages = [
    {"role": "user", "content": "介绍下你自己"}
]

res = openai.ChatCompletion.create(
    model="gpt-4-1106-preview",
    messages=messages,
    stream=False
)

print(res['choices'][0]['message']['content'])
